package serviceInv

import (
	"context"
	"mxshop/app/mxshop_api/api/internal/data"
	dtoInv "mxshop/app/mxshop_api/api/internal/domain/dto/inv"
	srvInv "mxshop/app/mxshop_api/api/internal/service/inv"
)

type InvService struct {
	data data.DataFactory
}

func (is *InvService) GetInvDetail(ctx context.Context, ID int64) (*dtoInv.InventoryDTO, error) {
	var ret dtoInv.InventoryDTO

	rsp, err := is.data.Inv().Inventory().InvDetail(ctx, ID)
	if err != nil {
		return nil, err
	}

	ret.InventoryDO = *rsp

	return &ret, nil
}

func newInv(data data.DataFactory) srvInv.InvSrv {
	return &InvService{data: data}
}
